home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / RELNOTES / JIB.TXT < prev    next >
Encoding:
Text File  |  1998-09-16  |  21.2 KB  |  598 lines

  1. ============================================================================
  2.  
  3.                         VisualAge for Java
  4.                            Version 2.0
  5.  
  6.                      Compiler and Related Topics
  7.  
  8.                           RELEASE NOTES
  9.  
  10. ============================================================================
  11.  
  12. Table of Contents
  13.  
  14. 1.0 Compiler
  15.  
  16.    1.1 Incremental Compilation
  17.  
  18.    1.2 Problem Handling
  19.  
  20.    1.3 Exporting Types
  21.  
  22.    1.4 Debug Attributes
  23.  
  24.    1.5 Inner Types
  25.       1.5.1 Default Abstract Methods
  26.       1.5.2 Imports in Default Package
  27.       1.5.3 Explicit Qualification
  28.       1.5.4 this.super()
  29.       1.5.5 Access to Synthetic Names
  30.       1.5.6 Method Overloading
  31.       1.5.7 Anonymous Type Modifiers
  32.       1.5.8 Visibility of Sibling Classes
  33.       1.5.9 Use of Member Interfaces
  34.  
  35.    1.6 Other Clarifications and Limitations
  36.       1.6.1 Circular Constructor Invocation
  37.       1.6.2 Incompatible Interfaces
  38.       1.6.3 Class and Method Collisions
  39.       1.6.4 Method Ordering on Export
  40.       1.6.5 Type Visibility in a Default Package
  41.       1.6.6 Empty Statements
  42.       1.6.7 Simple Name Imports
  43.       1.6.8 Protected Constructor Visibility
  44.       1.6.9 Numeric Underflow
  45.       1.6.10 Definite Assignment in Dead Code
  46.       1.6.11 Assignment Conversion
  47.       1.6.12 Incremental Compiler may Produce Conflicting serialVersionUID
  48.       1.6.13 Static Final Variable Dependency Analysis
  49.       1.6.14 Side Effects of Copy/Rename
  50.       1.6.15 Source positions for Do-While Loop
  51.       1.6.16 Inconsistencies during Incremental Compilation 
  52.  
  53. 2.0 Searching
  54.  
  55. 3.0 Referenced Types
  56.  
  57. 4.0 Project Limitations
  58.  
  59. 5.0 .class files in the IDE
  60.  
  61.  
  62. 1.0 Compiler
  63.  
  64. VisualAge for Java implements the Java Language Specification. In
  65. areas where the specification is unclear, VisualAge uses JDK
  66. 1.1.6 as a reference implementation.
  67.  
  68. 1.1 Incremental Compilation
  69.  
  70. VisualAge supports incremental compilation.  Incremental
  71. compilation allows the developer to see the effects of his/her
  72. changes as they are made, rather than explicitly invoking the
  73. compiler periodically to find the problems that have been introduced
  74. during the last edit cycle.  In addition to compiling the method that
  75. the developer has just changed, any methods that are impacted by this
  76. change are also automatically recompiled.  Changing (or adding or
  77. deleting) a class definition also triggers this automatic
  78. recompilation.  As a result, binary compatibility is automatically
  79. ensured by the compiler for any program implemented within the
  80. environment.
  81.  
  82. These incremental changes take effect immediately.  A thread that is
  83. repeatedly invoking a method immediately starts executing the new
  84. method.  Code may be changed in the debugger as well; any change in
  85. the debugger takes effect upon completion of the edit and save.
  86.  
  87. 1.2 Problem Handling
  88.  
  89. All problems that are detected are classified as either warnings or
  90. errors.  Warnings are reported on problems that can be ignored by the
  91. compiler without changing the semantics of the developer's program.
  92. The existence of a warning does not effect the execution of the
  93. program; the code executes as if it were written correctly (e.g.
  94. detecting unreachable code does not prevent running it).  Errors are
  95. more severe problems that cannot be ignored since the semantics of
  96. the program is corrupted, and therefore its execution cannot
  97. complete.  If there is an error in a method, the debugger shows the
  98. problem description and a stack trace containing the problem method
  99. (or if it is an initialization problem, the constructor or the code
  100. that triggered the static initialization). A method with an error
  101. cannot be run until the error is fixed.
  102.  
  103. The VisualAge compiler detects problems in several phases (e.g.
  104. parsing, type checking, code generation, ...).  Proceeding to the
  105. next phase is allowed only if no error has been detected so far.
  106. Thus errors detected in some phases cause the compilation process to
  107. be aborted.  Therefore, fixing a compilation problem may reveal other
  108. previously unreported problems.
  109.  
  110. Some problems are more serious than others.  If a class subclasses a
  111. nonexistent class for example, VisualAge cannot create instances of
  112. this class.  It is also difficult to accurately compile methods when
  113. much of the context is unavailable.  Under these conditions, the
  114. compiler ignores the methods.  Later, when the missing classes and
  115. interfaces are available, the methods are fully compiled
  116. automatically.
  117.  
  118. The conditions above may cause reported problems to appear to have
  119. been lost:
  120.  
  121.    a. The problems have been superceded by more significant errors
  122. and just discarded.  If the more serious errors are resolved, these
  123. problems will return.
  124.  
  125.    b. A field initialization problem was detected and reported
  126. against the constructor.  When such a constructor is saved, the
  127. problem report is "credited" to the class and no longer kept with the
  128. constructor.
  129.  
  130. Classes must be syntactically correct in order for the compiler to
  131. accept them; however methods only need a syntactically valid method
  132. header.  Such a method is recorded in the workspace as a problem
  133. method, and behaves as described above.
  134.  
  135. Some problems reported on classes do not provide source highlighting.
  136. For these problems, you should attempt to deduce the effected type
  137. and find it in the class definition source.
  138.  
  139. 1.3 Exporting Types
  140.  
  141. A type can be exported in two formats: .java or .class.  A type in
  142. the environment that is from a .class file can only be exported in
  143. .class format since there is no source available.  Any source class
  144. can be exported as either .java or .class format.  The IDE does not
  145. allow a developer to export in .class format if there are any errors
  146. in the class - these errors must be corrected first.  However, it is
  147. possible to export in .java format even if there are errors.  In this
  148. case, the resulting file is not valid input for another java compiler.
  149.  
  150. 1.4 Debug Attributes
  151.  
  152. The VisualAge compiler produces debug attributes (if requested).  
  153.  
  154. A Java compiler must prevent any user code from explicitly reading 
  155. an unitialized local variable, however a program may get interrupted 
  156. in a state where some variables are not yet set, but already declared
  157. (user interrupt, ...) and a debugger may try to show all visible 
  158. variables at this point using the debug attributes recorded in .class 
  159. files for this purpose. These debug attributes contain the visibility 
  160. range for each local variable, and VisualAge for Java considers each 
  161. variable to be visible from its declaration to the end of its 
  162. definition scope, where other compilers may consider it to be visible 
  163. only once it is initialized.
  164.  
  165. Therefore some external debuggers may fail on VisualAge output when
  166. attempting to display variables which are not yet bound to a value
  167. (e.g. trying to display the content of an array which has not yet 
  168. been defined). The VisualAge debugger handles this case correctly.  
  169. Due to the VisualAge algorithm for assigning visibility ranges, a 
  170. debugger may order local variables differently when using VisualAge 
  171. output than when using another compiler's output.
  172.  
  173. 1.5 Inner Classes
  174.  
  175. The Inner Classes Specification does not cover the full
  176. implementation details and is still being enhanced.  Given this
  177. situation, VisualAge has relied on the JDK behavior to
  178. provide insight.
  179.  
  180.  
  181. 1.5.1 Default Abstract Methods
  182.  
  183. A compiler should produce default abstract methods for any abstract
  184. class that does not implement or inherit implementations methods
  185. defined in the abstract class' superinterfaces.  VisualAge
  186. correctly produces these default abstract methods for top level and
  187. type member classes; however, these methods are not produced for
  188. local types.  If this condition should occur, a compilation error is
  189. reported. To work around this limitation, simply explicitly define
  190. the necessary abstract methods in the abstract local class.
  191.  
  192.  
  193. 1.5.2 Imports in Default Package
  194.  
  195. If type members are imported in a type from a default package, a
  196. warning is incorrectly reported notifying the developer that the
  197. package does not exist.  This warning should be ignored.
  198.  
  199.  
  200. 1.5.3 Explicit Qualification
  201.  
  202. VisualAge does not request explicit qualification for implicit use of
  203. inherited methods, when it is hiding an enclosing one. VisualAge
  204. considers inherited methods prior to enclosing ones without issuing
  205. an error (note that qualifying explicitly the code would be accepted
  206. as well).
  207.  
  208. Here is a example of such a case, the implicit access to foo() should
  209. yield a complaint:
  210.  
  211. public class MethodQualification {
  212.    void foo() {
  213.       System.out.println("Inherited foo() for anonymous type");
  214.       class Local {
  215.          void foo(){
  216.             System.out.println("Enclosing foo() for anonymous type");
  217.             // should request explicit qualification
  218.             new MethodQualification () { {foo();} }; 
  219.          }
  220.       };
  221.    }
  222. }
  223.  
  224. another example involving fields :
  225.  
  226. public class FieldQualification {
  227.    String field = "Inherited field for anonymous type";
  228.    void foo() {
  229.       class Local {
  230.          String field = "Enclosing field for anonymous type";
  231.          void foo() {
  232.             new FieldQualification() {
  233.                {
  234.                   // should request explicit qualification
  235.                   System.out.println(field); 
  236.                }
  237.             };
  238.          }
  239.       };
  240.    }
  241. }
  242.  
  243.  
  244. 1.5.4 this.super()
  245.  
  246. Some compilers allow constructors to contain super invocation of the
  247. form "this.super()".  VisualAge rejects this because it is not legal
  248. to use this in a constructor invocation (JLS 8.6.5).
  249.  
  250.  
  251. 1.5.5 Access to Synthetic Names
  252.  
  253. VisualAge does allows the use of $ names to refer to nested types.
  254. In addition, VisualAge allows the use of $ names to access synthetic
  255. fields.  Developers should not use these names.
  256.  
  257.  
  258. 1.5.6 Method Overloading
  259.  
  260. The inner class specification notes that class scoping does not
  261. influence overloading.  VisualAge searches through enclosing types
  262. until an applicable method is found.  If a method with the intended
  263. name, but that does not have the correct number of arguments is
  264. found, it is ignored, and the search is continued.  Some compilers
  265. stop when reaching this type of method.
  266.  
  267.  
  268. 1.5.7 Anonymous Type Modifiers
  269.  
  270. Some compilers treat anonymous inner types as final types with
  271. respect to casting conversion. VisualAge does not do this; therefore
  272. some casting conversion problems may only be detected at runtime, as
  273. shown in the following example:
  274.  
  275. class CheckInstanceOf {
  276.    void v() {
  277.       new Object() {
  278.          // should complain on the instanceof check at compile-time
  279.          boolean b = this instanceof Runnable;  
  280.       };
  281.    }
  282. }
  283.  
  284.  
  285. 1.5.8 Visibility of Sibling Classes
  286.  
  287. The rules determining the visibility of sibling classes will
  288. report an error anytime a local type is defined with the same name as
  289. a sibling member type.  In the following example, M2 defined as a
  290. local type is actually in conflict with the sibling member class,
  291. which is also visible and bound as M1's superclass.  VisualAge
  292. reports this error.
  293.  
  294. class ExportedNames {
  295.   void foo() {
  296.     class Local {
  297.       class M1 extends M2 {
  298.         void bar() {
  299.           class M2 {} // M2 already defined
  300.         }
  301.       }
  302.       class M2 {}
  303.     }
  304.   }
  305. }
  306.  
  307. 1.5.9 Use of Member Interfaces
  308.  
  309. Some compilers may accept the following code, however specifications
  310. are unclear whether this is legal or not, and issues are still being
  311. debated at this point.
  312.  
  313. class A implements A.C {
  314.   interface C {}
  315. }
  316.  
  317. VisualAge for Java will reject such code claiming A.C is not defined.
  318.  
  319. Note that using a static member class is rejected by all compilers, 
  320. even though the same rule as for interface should apply since there
  321. is no need for an enclosing instance.
  322.  
  323. class A extends A.C {
  324.   static class C {}
  325. }
  326.  
  327. 1.6 Other Clarifications and Limitations
  328.  
  329.  
  330. 1.6.1 Circular Constructor Invocation
  331.  
  332. It is a compile-time error for a constructor to directly or
  333. indirectly invoke itself through a series of one or more explicit
  334. constructor invocations involving 'this' (JLS 8.6.5). Only the direct
  335. invocation case is detected in the current implementation. 
  336.  
  337.  
  338. 1.6.2 Incompatible Interfaces
  339.  
  340. It is a compile-time error to cast an interface T to an interface S
  341. if S and T contain methods with the same signature but different
  342. return types (JLS 5.5). We do not detect this error at compile time,
  343. but detect it at runtime, and throw a class cast exception. 
  344.  
  345.  
  346. 1.6.3 Class and Method Collisions
  347.  
  348. During source file import, class and method collisions are silently
  349. ignored.  The last definition in the file is used.  This also occurs
  350. if the class definition contains two definitions of a single method.
  351.  
  352.  
  353. 1.6.4 Method Ordering on Export
  354.  
  355. When exporting code, the ordering of methods may not be the same as
  356. during the initial import, nor the previous export, thus no
  357. assumption should be made on the method ordering in exported source
  358. files or class files.  Field ordering is preserved.
  359.  
  360.  
  361. 1.6.5 Type Visibility in a Default Package
  362.  
  363. Classes defined in a default package are only visible within the
  364. default package.  It is not possible to access these classes from
  365. outside the default package.
  366.  
  367.  
  368. 1.6.6 Empty Statements
  369.  
  370. Empty statements are ignored.  Therefore the compiler does not report
  371. unreachable code errors on unreachable empty statements.  The
  372. following methods exhibits this behavior:
  373.  
  374. void f () {
  375.    return;
  376.    label: ;
  377. }
  378.  
  379. void g () {
  380.    return;
  381.    ;;;;;
  382. }
  383.  
  384. In addition, semicolons are silently ignored when included in a
  385. class definition.  Therefore the compiler accepts without complaint
  386. the following class definition
  387.  
  388. class C {
  389.    ;;;;
  390. }
  391.  
  392.  
  393. 1.6.7 Simple Name Imports
  394.  
  395. An import of a simple name is ignored.  No errors are detected or
  396. reported, and the import is ignored during name resolution. 
  397.  
  398.  
  399. 1.6.8 Protected Constructor Visibility
  400.  
  401. It is an error for a protected constructor to be invoked from another
  402. package, even if the type is a subclass of the type defining the
  403. constructor (JLS 6.6.2).  VisualAge detects and reports this error.
  404.  
  405.  
  406. 1.6.9 Numeric Underflow
  407.  
  408. VisualAge does not report compile time numeric underflow.  Therefore
  409. the following incorrect code is accepted:
  410.  
  411.     double ds =1.0E-326;
  412.  
  413. This expression has a value of 0.0.
  414.  
  415.  
  416. 1.6.10 Definite Assignment in Dead Code
  417.  
  418. Definite assignment in conditionals is handled differently depending
  419. on compiler implementations. VisualAge will detect dead code
  420. and not propagate initializations outside the dead code. Note that
  421. definite assignment rules for an IF statement enforce that even
  422. though the code inside the dead branch is unreachable, it is not
  423. reported as such and is silently eliminated during code generation.
  424.  
  425. class DeadCode1 {
  426.    final static boolean Debug = false;
  427.    int foo() {
  428.       final int i;
  429.       if (Debug) i = 1;
  430.       i = 2;  // some compilers complain about a duplicate assignment.
  431.       return i;
  432.    }
  433. }
  434.  
  435. In the following example, VisualAge reports that the
  436. assignment 'k = i' is using an uninitialized variable, and since this
  437. assignment is in dead code, it actually never occurs and therefore
  438. the next assignment statement sets the local 'k' for the first time.
  439.  
  440. class DeadCode2 {
  441.   final static boolean Debug = false;
  442.   int foo() {
  443.     int i;
  444.     final int k;
  445.     if (Debug) { k = i; } // local i may not be initialized.
  446.     k = 1;
  447.     return k;
  448.   }
  449. }
  450.  
  451.  
  452. On the following example, VisualAge only reports the use of an
  453. uninitialized variable.
  454.  
  455. class DeadCode3 {
  456.    final static boolean Debug = false;
  457.       int foo() {
  458.          int i;
  459.          final int k;
  460.          if (false) { k = i; } 
  461.          if (false) { k = 1; }
  462.          k = 1;     
  463.          return k;
  464.       }
  465. }
  466.  
  467.  
  468. 1.6.11 Assignment Conversion
  469.  
  470. VisualAge does not provide an implicit narrowing conversion for 
  471. constant expressions from char to byte.  JLS 5.2 notes that this 
  472. conversion can only be done if the constant expression is of type 
  473. int. Some compilers did support this in the past.
  474.  
  475. The following statements are not accepted by VisualAge:
  476.  
  477. byte b = 'a';  // JLS 5.2
  478. byte[] ar = {'a'};   // JLS 5.2, 10.6
  479.  
  480.  
  481. 1.6.12 Incremental Compiler may Produce Conflicting serialVersionUID
  482.  
  483. To facilitate incremental compilation, synthetic fields and methods
  484. are not created. Although this usually does not impact program
  485. execution, it may impact the serialVersionUID (since the synthetic
  486. methods are considered when computing the serialVersionUID
  487. for the class). When this condition arises, objects serialized in 
  488. the IDE will not be readable by another runtime. There are two 
  489. ways to produce consistent serialVersionUID's everywhere.  First, 
  490. define a static long field serialVersionUID that records the 
  491. serialization hash.  Second, if editing the source is not 
  492. a viable solution, export the necessary classes as .class files 
  493. and then re-import them.
  494.  
  495.  
  496. 1.6.13 Static Final Variable Dependency Analysis
  497.  
  498. If a static final variable depends on the value of a static final
  499. variable defined in another class, then changing the second
  500. variable's value does not cause the initial variable's value to
  501. change.  To work-around this problem, delete and add the offending
  502. project, package, or type.  Any dependency error can be resolved
  503. using this work-around.
  504.  
  505.  
  506. 1.6.14 Side Effects of Copy/Rename
  507.  
  508. When a package or class is copied or renamed, qualified references to
  509. the changed package or class are not edited.  Rather problems are
  510. reported to show the developer where the code must be changed.
  511.  
  512.  
  513. 1.6.15 Source positions of Do-While Loop
  514.  
  515. The computation of source positions of Do-While loops is wrong, and
  516. may affect debug attributes produced by the compiler. This in turn
  517. may affect highlighting within the debugger. Another consequence is
  518. that the code assist may not provide assistance inside a Do-While
  519. loop.
  520.  
  521.  
  522. 1.6.16 Inconsistencies during Incremental Compilation 
  523.  
  524. When incrementally adding a missing type, there are circumstancies
  525. where the incremental compilation process will fail to automatically
  526. update some existing problems. This problem only occurs when the only
  527. reference to the added type corresponds to one of the following cases:
  528.  
  529.   - missing type was the return type of a method being invoked,
  530.   - missing type was the type of a field being accessed,
  531.   - missing type was an exception type of a method being invoked,
  532.   - missing type was type of a field defined in a local class,
  533.  
  534. When adding the required implementations for abstract methods defined
  535. on implemented interfaces, the incremental compilation process may
  536. fail to update the subclasses of the class where the required method
  537. implementations are defined.
  538.  
  539. In all such cases, forcing the code to recompile will be the only way 
  540. to get rid of those undesirable problems (for example: unload then 
  541. reload the offending code).
  542.  
  543.  
  544. 2.0 Searching
  545.  
  546. The search engine examines the .class file information associated
  547. with the class.  There are times when the results of such a search
  548. can provide non-intuitive results.  In particular, a constructor
  549. reports that it references a type if the field initializer for that
  550. type in the class definition references a type.  This occurs because
  551. the instance field initializers become part of the constructor at
  552. compile time.
  553.  
  554. If the search engine finds an inner type, it answers the enclosing
  555. type or enclosing method as the result.  The inner type can then be
  556. found in the enclosing type or enclosing method.
  557.  
  558.  
  559. 3.0  Referenced Types
  560.  
  561. VisualAge computes the referenced types and referenced
  562. projects given a starting class. The mechanism for doing this is
  563. similar to the search engine described above.  There are a few
  564. limitations with the current solution.  First, references to a class
  565. by name are not considered a reference to the class.  For example,
  566. the expression Class.forName("MyPackage.MyClass") does not report a
  567. reference to MyPackage.MyClass.  Second, the referenced types
  568. algorithm does not include types that are only found in method
  569. signatures.  This is not a limitation for programs since a program
  570. always provides an argument of the appropriate type.  However, if you
  571. are exporting a framework, it is possible that some types may be
  572. omitted.  Finally, if there are errors in the classes that are being
  573. searched for referenced types, the operation fails.  To work-around
  574. this problem, add the missing types.
  575.  
  576.  
  577. 4.0 Project Limitations
  578.  
  579. For each project in the workspace, a corresponding resources
  580. directory is created.  This directory is named with the project name.
  581. If the project name is not a valid directory name, most likely
  582. because the name was too long, the directory will not be created and
  583. a message will be written to the log.
  584.  
  585. In the enterprise version of VisualAge, the Administrator can change
  586. the owner of the system projects to another user.  It is strongly
  587. recommended that the Administrator does not change this unnecessarily.
  588.  
  589.  
  590. 5.0 .class Files in the IDE
  591.  
  592. VisualAge manages both source and binary (.class file)
  593. classes.  Binary classes are not verified on import.  It is assumed
  594. that only valid class files are imported.  A system error may be
  595. reported if an invalid class file is imported.  The compiler validates 
  596. the superclass and superinterfaces of the binary class, and also the 
  597. fields when the class is added to the workspace.  The methods are not 
  598. validated.